package com.allwees.bs.c.module.payment.repository;

import com.allwees.bs.c.module.base.repository.BaseRepository;
import com.allwees.bs.c.module.payment.entity.PaymentLogEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 付款日志查询
 */
public interface PaymentLogRepository extends BaseRepository<PaymentLogEntity, Integer> {

	PaymentLogEntity getByUuid(String uuid);

    @Query("SELECT p FROM PaymentLogEntity p WHERE p.paymentToken =:paymentToken")
    PaymentLogEntity findByPaymentToken(@Param("paymentToken") String paymentToken);

    PaymentLogEntity findByOrderUuid(String orderUuid);

    // TODO 在清理数据的时候发现，居然还有不唯一的情况，说明事务不安全在原来的创建函数中
    List<PaymentLogEntity> findAllByOrderUuid(String orderUuid);
}
